package com.cnswhy.cloud.server.merchant.controller;

import com.alibaba.fastjson.JSONObject;
import com.cnswhy.cloud.common.core.base.R;
import com.cnswhy.cloud.common.core.utils.CnswhyUtil;
import com.cnswhy.cloud.server.core.oem.OemService;
import com.cnswhy.cloud.server.core.service.CustomerWalletService;
import com.cnswhy.cloud.server.core.service.CustomerWithdrawalRecordService;
import com.cnswhy.cloud.server.core.service.customer.CustomerService;
import com.cnswhy.cloud.server.core.service.spell.SpellOrderService;
import com.cnswhy.cloud.server.merchant.dto.HomeDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@Slf4j
@RestController
public class HomeController {
    @Autowired
    CustomerService customerService;
    @Autowired
    CustomerWalletService customerWalletService;
    @Autowired
    SpellOrderService spellOrderService;
    @Autowired
    CustomerWithdrawalRecordService customerWithdrawalRecordService;
    /**
     * 获取当前信息
     */
    @GetMapping("home")
    public R<HomeDto> home() {

        HomeDto homeDto = new HomeDto();
        homeDto.setTodayCustomer(customerService.getSumToday());
        homeDto.setTotalCustomer(customerService.getSum());
        return R.success(homeDto);
    }
    @Autowired
    OemService oemService;
    @GetMapping("webInfo")
    public R<Map<String, Object>> webInfo() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("oemInfo",oemService.getOemInfo());
        return R.success(jsonObject);
    }
}
